/**
 * c
 * Created by dabai on 2018/3/26.
 */
var CreateRoomWindow = Window.extend({
    _blockLayerOpacity: 0,
    /**
     * 当前的模块
     * @type {String}
     * @private
     */
    _sub: null,
    /**
     * 当前的选项
     * @type {String}
     * @protected
     */
    _curSelectedTab: null,
    _curbtnTab: null,
    /**
     * tablist文件
     * @type {String}
     * @private
     */
    _tabCcsFile: null,
    /**
     * tablist文件
     * @type {String}
     * @private
     */
    _wanfaCcsFile: null,
    /**
     * tab数据
     * @type {Object}
     * @private
     */
    _tabData: null,
    /**
     * wanfa数据
     * @type {Array}
     * @private
     */
    _wanfaData: null,

    /**
     * 房卡数据
     * @type {Object}
     * @protected
     */
    _fangkaData: null,

    /**
     * 玩法模块中的 具体玩法
     * @type {Object}
     * @protected
     */
    _subAddit: null,

    /**
     * 是否是代开
     * @type {boolean}
     * @protected
     */
    _isDaikai: false,
    /**
     * 是否是设置玩法
     * @type {boolean}
     * @protected
     */
    _isSetWanfa: false,
    /**
     * 俱乐部id
     * @type {Number}
     * @protected
     */
    _clubId: null,
    /**
     * tab list
     * @type {Array}
     * @private
     */
    _tabList: [],
    /**
     * checkbox list
     * @type {Object}
     * @protected
     */
    _cbList: {},
    /**
     * 房卡列表
     * @type {Array}
     * @protected
     */
    _fangkaTextList: [],

    /**
     * csd子玩法一定要给_ccsFileName重新赋值去加载自己玩法的创建房间界面
     * @private
     */
    _ccsFileName: res.CreateRoomWindow_json,
    
    _currentTab:'',
    _TabBtnData:{},

    _textColor: {
        ON: cc.color('#d7842a'),
        OFF: cc.color('#638f9f')
    },


    // onEnter: function (_sub, _isDaikai, club_id, _isSetWanfa, _setwanfapos, subAddit) {
    //     Window.prototype.onEnter.call(this);
    //     this._init(_sub, _isDaikai, club_id, _isSetWanfa, _setwanfapos, subAddit);
    // },

    /**
     * 初始化
     * @param _sub
     * @param _isDaikai
     * @param club_id
     * @param _isSetWanfa
     * @param _setwanfapos
     * @param subAddit
     * @private
     */
    initWindow: function (_sub, _isDaikai, club_id, _isSetWanfa, _setwanfapos, subAddit, selectWanfaType) {
        if (!_sub) {
            cc.error('模块为空');
            return;
        }
        // console.log("subAddit " + subAddit);
        this._sub = _sub;
        this._isDaikai = !!_isDaikai;
        this._clubId = club_id || 0;
        this._isSetWanfa = _isSetWanfa;
        this._setwanfapos = _setwanfapos;
        subAddit = subAddit ? '_' + subAddit : '';
        this._tabData = window[_sub]['create_room_tabData'] || window[_sub + '_create_room_tabData' + subAddit] || window[_sub + '_create_room_tabData'];
        this._wanfaData = window[_sub]['create_room_wanFaData'] || window[_sub + '_create_room_wanFaData' + subAddit] || window[_sub + '_create_room_wanFaData'];
        this._fangkaData = window[_sub]['fangka'] || window[_sub + '_fangka' + subAddit] || window[_sub + '_fangka'];
        this._btnListClearance = window[_sub + 'btn_list_clearance'] || window[_sub + '_btn_list_clearance' + subAddit] || window[_sub + '_btn_list_clearance'];
        this._clubHunZhuoData = window[_sub]['club_hunzhuo'] || window[_sub + '_club_hunzhuo' + subAddit] || window[_sub + '_club_hunzhuo'];
        if(window[_sub]['tabData'] ){
            this._TabBtnData = window[_sub]['tabData'];
        }
        this._btnList = window[_sub + '_btn_list'];
        this._subAddit = subAddit;


        this._fangkaTextList = [];
        this._tabList = [];
        this._cbList = {};
        if (!this._tabData) {
            cc.error('create room tab data is null!');
            return;
        }
        if (!this._wanfaData) {
            cc.error('create room wanfa data is null!');
            return;
        }
        this._curSelectedTab = cc.sys.localStorage.getItem('create_room_tab_' + _sub + '_' + this._subAddit);
        this._curbtnTab = cc.sys.localStorage.getItem('create_room_btn_' + _sub + '_' + this._subAddit);
        if (!selectWanfaType) {
            if (!this._curSelectedTab) {
                var btnList = this._TabBtnData['tab_poke']['btnList'];
                this._curSelectedTab = btnList[0];
            }
            if (!this._curbtnTab) {
                this._curbtnTab = 'tab_poke';
            }
        }
        else {
            var btnList = this._TabBtnData[selectWanfaType]['btnList'];
            this._curSelectedTab = btnList[0];
            this._curbtnTab = selectWanfaType;
        }
        this._clickMapId = this._tabData[this._curSelectedTab]['click'][0];
        this._addTabList();
        this._addWanfa();
        this._initWanfa();
        this._loadSelected();
        this._initTouch();
        this.setBtnList(this._curbtnTab,true);
        // this._changeTab(this._curSelectedTab);
        hideDownLoading();
    },
    setBtnList:function (tabName,init) {
        for( var key in this._TabBtnData){
            var btnList = this._TabBtnData[key]['btnList'];
            var show = this._TabBtnData[key]['show'];
            var hide = this._TabBtnData[key]['hide'];
            for(var i = 0 ; i < btnList.length ; i++){
                this._nodeList['tabList'][btnList[i]].setVisible(key == tabName);
                this._nodeList['tab_list'][key].setTexture(key == tabName ? show  : hide);
            }
            if(key == tabName){
                this._curbtnTab = tabName ;
                if(init){
                    this._changeTab(this._curSelectedTab);
                }else {
                    this._changeTab(btnList[0]);
                }
            }

        }
        this._currentTab = tabName;
    },
    setTabList:function (tabIndex) {
        var tabName = tabIndex.getName();
        this.setBtnList(tabName)
    },


    _initClickListeners: function () {
        Window.prototype._initClickListeners.call(this);
        this._clickListeners = {
            'btn_create': '_clickCreate',
            'btn_back': '_clickClose'
        };
    },

    /**
     * 添加tabList
     * @private
     */
    _addTabList: function () {
        this._tabList = this._nodeList['tabList'].getChildren();
        for (var i = 0; i < this._tabList.length; i++) {
            var tab = this._tabList[i];
            TouchUtil.setOnclickListener(tab, this._clickTab.bind(this), {
                effect: TouchUtil.effects.SEPIA,
                swallowTouches: false
            });
        }
        for (var key  in  this._TabBtnData ){
            var tab = this._nodeList['tab_list'][key];
            TouchUtil.setOnclickListener(tab, this.setTabList.bind(this), {
                effect: TouchUtil.effects.SEPIA,
                swallowTouches: false
            });
        }
        this.initXianMian();
    },
    /**
     * 初始化限免
     */
    initXianMian: function () {
        if (!gameData.map_conf) {
            return;
        }
        for (var i = 0; i < this._tabList.length; i++) {
            var tab = this._tabList[i];
            var name = tab.getName();
            if (this._tabData.hasOwnProperty(name)) {
                var mapName = this._tabData[name]['click'][0];
                var ids = mapName.split('_');
                if (!ids || !ids.length || ids.length < 1) {
                    continue;
                }
            }
            var mapidx = ids[1];
            var mapid = -1;
            for (var j = 0; j < this._wanfaData.length; j++) {
                var item = this._wanfaData[j];
                if (item[0] == 'mapid') {
                    mapid = item[1][mapidx][1];
                    break;
                }
            }
            var xm = gameData.map_conf[mapid];
            // 0正常  1免费 -1不显示
            switch (xm) {
                case 1:
                    tab.setVisible(true);
                    tab.getChildByName('xm').setVisible(true);
                    break;
                case -1:
                    tab.setVisible(false);
                    break;
                case 0:
                default:
                    tab.setVisible(true);
                    tab.getChildByName('xm').setVisible(false);
                    break;
            }
            if (window.inReview) {
                tab.getChildByName('xm').setVisible(false);
            }
        }
    },
    /**
     * 添加玩法
     * @private
     */
    _addWanfa: function () {
        var self = this;
        // var wfcss = ccs.load(this._wanfaCcsFile, 'res/');
        // if (!wfcss || !wfcss.node) {
        //     // console.log('load create room tab list ccs error !!!');
        //     return;
        // }
        //
        // // $('wanfa_node').addChild(wfcss.node);
        // this._nodeList['wanfa_node'].addChild(wfcss.node);
        var data = this._wanfaData;
        this._cbList = {};
        // var baseCheckbox = $('wanfa_node.cb');
        var baseCheckbox = this._nodeList['wanfa_node.cb'];
        for (var k = 0; k < data.length; k++) {
            var catName = data[k][0];
            var optArr = data[k][1];
            // 隐藏审核项
            if ((window.inReview || window.inBanShu) && (catName == 'aatype' || catName == 'AA'))
                continue;
            //俱乐部创建  房主支付 改为 群主支付
            if (this._clubId && catName == 'AA') {
                for (var s = 0; s < optArr.length; s++) {
                    if (optArr[s][0] == '房主支付') {
                        optArr[s][0] = '群主支付';
                        break;

                    }
                }
            }
            for (var i = 0; i < optArr.length; i++) {
                // 配置数据
                // 隐藏审核项
                if ((window.inReview || window.inBanShu) && optArr[i][0] == 'GPS定位')
                    continue;
                var opt = optArr[i];
                // 拷贝checkbox
                var node = duplicateNode(baseCheckbox);
                baseCheckbox.getParent().addChild(node);
                // 命名
                var name = catName + '_' + i;
                node.setName(name);
                // 设置坐标
                node.setPosition(cc.p(opt[CreateR.IDX_POSX], opt[CreateR.IDX_POSY]));
                // 设置单选复选框
                this._changeCheckBox(node,  opt[CreateR.IDX_UNDESELECTABLE]);
                // 取得checkbox
                var checkbox = node.getChildByName('checkBox');
                // 取得text
                var text = node.getChildByName('text');
                // 设置文本
                text.setString(decodeURIComponent(opt[CreateR.IDX_DESP]));
                // 设置hint
                var hintTxt = node.getChildByName('hint');
                hintTxt.setTag(k * 100 + i);

                var hintTxtBg = hintTxt.getChildByName('bg');
                var hint = opt[CreateR.IDX_HINT];
                // 下拉列表
                var isPopup = _.last(catName.split('_')) == 'popup';
                if (_.isString(hint)) {

                    var showHintTxtBg = duplicateNode(hintTxtBg);

                    var cloneContent = new cc.LabelTTF();
                    cloneContent.setFontSize(24);
                    cloneContent.setVisible(true);
                    cloneContent.boundingWidth = 200;
                    cloneContent.setString(hint);
                    showHintTxtBg.setContentSize(cc.size(cloneContent.getContentSize().width + 20, cloneContent.getContentSize().height + 20));
                    cloneContent.setPosition(cc.p(showHintTxtBg.getContentSize().width / 2, showHintTxtBg.getContentSize().height / 2));
                    showHintTxtBg.addChild(cloneContent);
                    showHintTxtBg.setName('showHintTxtBg' + hintTxt.getTag());

                    //var pos = hintTxt.getPosition();
                    //var WorldPos = hintTxt.getParent().convertToWorldSpace(pos);
                    //WorldPos.x = WorldPos.x - showHintTxtBg.getContentSize().width < 0 ? showHintTxtBg.getContentSize().width : WorldPos.x;
                    //WorldPos.y = WorldPos.y + showHintTxtBg.getContentSize().height > cc.director.getVisibleSize().height ? cc.director.getVisibleSize().height - showHintTxtBg.getContentSize().height : WorldPos.y;
                    //WorldPos.x = 990;
                    //WorldPos.y = 350;
                    showHintTxtBg.setPosition(cc.p(opt[CreateR.IDX_POSX] + 160, opt[CreateR.IDX_POSY] + 20));
                    this.addChild(showHintTxtBg, 10);


                    var posX = node.getChildByName('text').getPositionX() + node.getChildByName('text').getContentSize().width;
                    var addx = 30;
                    if (isPopup) {
                        addx = 70;
                    }
                    hintTxt.setPositionX(posX + addx);
                    hintTxt.setVisible(true);
                    var delta = 0;
                    var deltaSize = cc.size(delta, delta);

                    TouchUtil.setOntouchLongListener(hintTxt, function (node) {
                            self.getChildByName('showHintTxtBg' + node.getTag()).setVisible(true);

                        }, function (node) {
                            self.getChildByName('showHintTxtBg' + node.getTag()).setVisible(false);

                        }, function (node) {
                            self.getChildByName('showHintTxtBg' + node.getTag()).setVisible(false);

                        },
                        {effect: TouchUtil.effects.SEPIA});

                    showHintTxtBg.setVisible(false);

                } else {
                    hintTxt.setVisible(false);
                }
                // 以 '_' 开头的控件是纯文本，隐藏checkBox
                var noTextTouch = catName.charAt(0) == '_';
                // 下拉列表
                var isPopup = _.last(catName.split('_')) == 'popup';
                if (isPopup) {
                    this._createPopup(node);
                }
                // var popup = node.getChildByName('popup');
                // popup.setVisible(isPopup);
                // 保存列表(name如果相同会发生覆盖)
                this._cbList[name] = node;
                // 设置数据
                var userdata = {
                    desp: opt[CreateR.IDX_DESP],
                    key: catName,
                    val: opt[CreateR.IDX_VALUE],
                    state: !!opt[CreateR.IDX_DEF_VAL],
                    undeselectable: !!opt[CreateR.IDX_UNDESELECTABLE],
                    mutexField: opt[CreateR.IDX_MUTEX_FIELD],
                    depName: opt[CreateR.IDX_DEP_NAME],
                    isPopup: isPopup
                };
                node.setUserData(userdata);
                // 添加房卡
                if (catName.indexOf('jushu') == 0 || catName.indexOf('rounds') == 0) {
                    this._initFangkaText(node);
                }
                // 点击监听
                checkbox.addEventListener(this._cbListener, this);
                if (noTextTouch) {
                    node.getChildByName('checkBox').setVisible(false);
                    continue;
                }
                if (isPopup) {
                    node.getChildByName('checkBox').setVisible(false);
                    TouchUtil.setOnclickListener(text, this._cbTouchPop.bind(this), {effect: TouchUtil.effects.SEPIA, swallowTouches: false});
                    var popArrow = node.getChildByName('popArrow');
                    if (popArrow) {
                        TouchUtil.setOnclickListener(popArrow, this._cbTouchPop.bind(this), {effect: TouchUtil.effects.SEPIA});
                    }
                    continue;
                }
                TouchUtil.setOnclickListener(text, this._cbTouch.bind(this), {effect: TouchUtil.effects.SEPIA, swallowTouches: false});
            }
        }
        baseCheckbox.setVisible(false);
    },

    /**
     * 初始化玩法
     * @private
     */
    _initWanfa: function () {
        if (!this._cbList) {
            cc.error('创建房间选项框列表是空的');
            return;
        }
        for (var name in this._cbList) {
            if (!this._cbList.hasOwnProperty(name)) {
                continue;
            }
            var node = this._cbList[name];
            if (!node) {
                continue;
            }
            var userData = node.getUserData();
            if (!userData) {
                continue;
            }
            var checkbox = node.getChildByName('checkBox');
            if (!checkbox) {
                continue;
            }
            // 设置默认值
            checkbox.setSelected(userData.state);
            this.setSelected(node, userData.state);
        }
    },

    /**
     * 初始化房卡
     * @param node
     * @protected
     */
    _initFangkaText: function (node) {
        var kaImage = new cc.Sprite(createRoom.res.fangka);
        //kaImage.setScale(0.35)
        node.addChild(kaImage);
        kaImage.setPosition(cc.p(110, 0));
        var fkText = new ccui.Text();
        fkText.setFontSize(30);
        fkText.setTextColor(cc.color('#638f9f'));
        fkText.setPosition(cc.p(160, -0));
        fkText.setString('x99');
        node.addChild(fkText);
        this._fangkaTextList.push(fkText);
    },

    /**
     * 改变房卡
     * @param node
     * @protected
     */
    _changeFangkaText: function (node) {
        var userData = node.getUserData();
        if (!userData) {
            return;
        }
        // 改变AA值或者地图id时才检测
        if (!userData.key || (userData.key.indexOf('AA') != 0 && userData.key.indexOf('mapid') != 0)) {
            return;
        }
        // 只有选择AA时候才处理
        var AANode = this._cbList['AA_1'];
        if (!AANode) {
            return;
        }
        var AAcb = AANode.getChildByName('checkBox');
        if (!AAcb) {
            return;
        }
        // AA是否选中
        var idx = AAcb.isSelected() ? 1 : 0;
        var tab = this._curSelectedTab || this._tabList[0].getName();
        if (!this._fangkaData || !this._fangkaData[tab] || !this._fangkaData[tab][idx]) {
            // console.log('房卡数据为空');
            return;
        }
        var _data = this._fangkaData[tab][idx];
        for (var i = 0; i < this._fangkaTextList.length; i++) {
            var id = i % _data.length;
            this._fangkaTextList[i].setString('x' + _data[id]);
        }
    },

    /**
     * 创建下拉菜单显示
     * @param node
     * @protected
     */
    _createPopup: function (node) {
        var popArrow = new cc.Sprite(res.popup);
        node.addChild(popArrow, -1);
        popArrow.setName('popArrow');
        var text = node.getChildByName('text');
        var checkBox = node.getChildByName('checkBox');
        var width = text.getContentSize().width + checkBox.getContentSize().width + 20;
        var height = checkBox.getContentSize().height;
        var color = cc.color('#f7c764');
        var pos = cc.p(-25, -20);
        var popBg = new cc.LayerColor(color, width, height);
        popBg.setPosition(pos);
        popBg.setName('bg');
        node.addChild(popBg, -2);
    },

    /**
     * 初始化点击事件
     * @private
     */
    _initTouch: function () {
        TouchUtil.setOnclickListener(this._nodeList['btn_create'], this._clickCreate.bind(this));
        TouchUtil.setOnclickListener(this._nodeList['btn_back'], this._clickClose.bind(this));
        // TouchUtil.setOnclickListener($('btn_create'), this.clickCreate.bind(this));
        // TouchUtil.setOnclickListener($('btn_back'), this.clickClose.bind(this));

    },

    /**
     * 点击创建
     * @protected
     */
    _clickCreate: function () {
        mRoom.wanfaMap = {};
        mRoom.wanfa = '';
        mRoom.special_gz = [];
        mRoom.wanfaArr = [];
        for (var id in this._cbList) {
            if (this._cbList.hasOwnProperty(id)) {
                var cb = this._cbList[id];
                var userData = cb.getUserData();
                var checkBox = cb.getChildByName('checkBox');
                // 选项框不存在
                if (!checkBox || !cc.sys.isObjectValid(checkBox)) {
                    continue;
                }
                // 不可见或者未被选中
                if (!cb.isVisible() || !checkBox.isSelected()) {
                    continue;
                }
                var key = userData.key;
                // 以 '_' 开头的直接忽略
                if (key.indexOf('_') == 0) {
                    continue;
                }

                if (key.indexOf('_') > 0) {
                    key = key.split('_')[0];
                }
                var value = userData.val;
                var desp = this._getSpecialDesp(key, userData.desp);
                // 生成option
                mRoom.wanfaMap[key] = value;
                // 添加玩法
                if (this._clubId && this._clubHunZhuoData && this._clubHunZhuoData[this._curSelectedTab] && desp.indexOf('人') > -1 && desp.indexOf('房') < 0) {
                    // gameData.useNewClub  快乐麻将混合牌桌字段  2001 带的参数。
                    // 只混合牌桌不能带 人数   （btn_7 转转麻将  btn_8 长沙麻将  btn_9 红肿麻将）
                    // 目前只快乐麻将 麻将玩法 有混合牌桌，才会走这个逻辑！
                } else {
                    if (desp) mRoom.wanfaArr.push(desp);
                }
                // 处理特殊参数
                this._generateExtraDespMap(key, desp);
                this._generateSpecialGz(key, desp);
            }
        }
        // 玩法
        mRoom.wanfa = mRoom.wanfaArr.join(',');
        mRoom.wanfaMap.desp = mRoom.wanfa;
        // 特殊规则
        mRoom.wanfaMap.special_gz = mRoom.special_gz;
        this._generateSpecialWanfa();
        if (mRoom.wanfaMap.rounds) {
            mRoom.wanfaMap.jushu = mRoom.wanfaMap.rounds;
        }

        if (this._clubId && this._clubId > 0){
            var tmpData = ClubDataManager._clubDataMap[this._clubId];
            if (tmpData == undefined || tmpData == null) {
                this._clubName = "";
                this._clubHead = "";
            }
            else {
                this._clubName = tmpData.name;
                this._clubHead = tmpData.head;
            }
        }
        else {
            this._clubName = "";
            this._clubHead = "";
        }

        if (this._isSetWanfa) {
            // network.send(2101, {
            //     cmd: 'wanfaClub',
            //     club_id: this._clubId,
            //     options: mRoom.wanfaMap,
            //     map_id: mRoom.wanfaMap['mapid'],
            //     desc: mRoom.wanfaMap.desp
            // });

            if (this._clubId && gameData.useNewClub && !mRoom.wanfaMap['wanjiarenshu0'] && !mRoom.wanfaMap['wanjiarenshu1'] && !mRoom.wanfaMap['wanjiarenshu2'] &&
                !mRoom.wanfaMap['sirenGuding'] && !mRoom.wanfaMap['sanrenSuiji'] && !mRoom.wanfaMap['sanrenGuding'] && !mRoom.wanfaMap['liangrenSuiji'] &&
                !mRoom.wanfaMap['liangrenwan'] && !mRoom.wanfaMap['sanrenwan'] &&!mRoom.wanfaMap['siren'] &&
                !mRoom.wanfaMap['cpCount'] && !mRoom.wanfaMap['maxPlayerCnt']) {
                showAlert('请选择一种牌桌人数');
                return;
            }

            mRoom.wanfaMap['club_id'] = this.clubId;
            network.send(2103, {
                cmd: 'addWanfa',
                club_id: this._clubId,
                club_info: {club_head : this._clubHead, club_name : this._clubName},
                options: mRoom.wanfaMap,
                desc: mRoom.wanfaMap.desp,
                map_id: mRoom.wanfaMap['mapid'],
                daikai: false,
                pos: this._setwanfapos
            });

            this.removeFromParent();
        } else {
            // HUD.showLoading("正在创建房间");
            showLoading('正在创建房间');
            mRoom.roomInfo = mRoom.wanfaMap;

            network.start();

            gameData.last3001Data = {
                room_id: 0
                , map_id: mRoom.wanfaMap['mapid']
                , mapid: mRoom.wanfaMap['mapid']
                , daikai: this._isDaikai
                , options: mRoom.wanfaMap
                , club_info: {club_head : this._clubHead, club_name : this._clubName}
                , club_nick: this._clubNick
                , timestamp: getCurTimestampMills()
            };
            if (this._setwanfapos == 5) {
                gameData.last3001Data.options.pos = this._setwanfapos;
                gameData.last3001Data.options.club_id = this._clubId;
                // gameData.enterRoomWithClubID = this.clubId;
            }
            network.send(3001, gameData.last3001Data);
        }
        this._saveSelected();
    },

    /**
     * 存档
     * @protected
     */
    _saveSelected: function () {
        if (this._curSelectedTab) {
            cc.sys.localStorage.setItem('create_room_tab_' + this._sub + '_' + this._subAddit, this._curSelectedTab);
        }
        if (this._curbtnTab) {
            cc.sys.localStorage.setItem('create_room_btn_' + this._sub + '_' + this._subAddit, this._curbtnTab);
        }
        if (!this._cbList || _.keys(this._cbList) == 0) {
            return;
        }
        var saveJson = {};
        for (var name in this._cbList) {
            if (this._cbList.hasOwnProperty(name)) {
                var node = this._cbList[name];
                if (node && cc.sys.isObjectValid(node) && node.getChildByName('checkBox')) {
                    var cb = node.getChildByName('checkBox');
                    saveJson[name] = {
                        visiable: node.isVisible(),
                        selected: cb.isSelected()
                    };
                }

            }
        }
        cc.sys.localStorage.setItem('create_room_cblist_' + this._sub, JSON.stringify(saveJson));
    },

    /**
     * 读档
     * @private
     */
    _loadSelected: function () {
        if (!this._cbList || this._cbList.length == 0) {
            return;
        }
        var saveJson = JSON.parse(cc.sys.localStorage.getItem('create_room_cblist_' + this._sub) || '{}');
        // 检查是否有不同的项,如果有的话清除存档
        if (_.difference(_.keys(this._cbList), _.keys(saveJson)).length > 0) {
            cc.sys.localStorage.removeItem('create_room_cblist_' + this._sub);
            return;
        }
        for (var name in this._cbList) {
            if (this._cbList.hasOwnProperty(name)) {
                var node = this._cbList[name];
                node.setVisible(saveJson[name].visiable);
                var cb = node.getChildByName('checkBox');
                cb.setSelected(saveJson[name].selected);
                this.setSelected(node,saveJson[name].selected)
                var text = node.getChildByName('text');
                if(text){
                    text.setTextColor(saveJson[name].selected?this._textColor.ON:this._textColor.OFF);
                }
            }
        }
    },

    /**
     * 点击关闭
     * @private
     */
    _clickClose: function () {
        this.removeFromParent(true);
    },

    /**
     * 点击tab
     * @param tab
     */
    _clickTab: function (tab) {
        this._changeTab(tab.getName());
    },

    /**
     * 改变tab
     * @param name
     * @protected
     */
    _changeTab: function (name) {
        name = name || this._tabList[0].getName();
        this._curSelectedTab = name;
        var foucsTab = null;

        // console.log("_changeTab -> " + this._curSelectedTab);

        // 控制foucs的显示隐藏
        for (var i = 0; i < this._tabList.length; i++) {
            var foucs = this._tabList[i].getChildByName('foucs');
            if (this._tabList[i].getName() == name) {
                foucsTab = this._tabList[i];
                foucs.setVisible(true);
                this._changeTabData(name);
            } else {
                foucs.setVisible(false);
            }
        }
        if (!foucsTab) {
            return;
        }
        // 处理如果存储的tab在视区外的情况(需要延迟执行)
        setTimeout(function () {
            var scrollView = foucsTab.getParent().getParent();
            if (scrollView.getInnerContainer().y + foucsTab.y < 0) {
                scrollView.jumpToBottom();
            }
        }, 1);
        // 处理特殊依赖
        this._handleSpecialDepend();
    },

    /**
     * 改变tab数据
     * @param name
     * @private
     */
    _changeTabData: function (name) {
        var _tabData = this._tabData[name];
        if (!_tabData) {
            return;
        }
        var click = _tabData['click'];
        var show = _tabData['show'];
        var hide = _tabData['hide'];
        // 处理click(只能响应1个)
        if (_.isArray(click)) {
            click = click[0];
        }
        this._clickMapId = click;
        if (this._cbList.hasOwnProperty(click)) {
            var node = this._cbList[click];
            var cb = node.getChildByName('checkBox');
            cb.setSelected(true);
            this.setSelected(node, true);
        }
        // 处理show(只处理同父节点下)
        if (!_.isArray(show)) {
            show = [show];
        }
        for (var i = 0; i < show.length; i++) {
            // var shownode = $('wanfa_node.Node.' + show[i]);
            var shownode = this._nodeList[show[i]];
            if (shownode && cc.sys.isObjectValid(shownode)) {
                shownode.setVisible(true);
            }
        }
        // 处理hide
        if (!_.isArray(hide)) {
            hide = [hide];
        }
        for (var j = 0; j < hide.length; j++) {
            // var hidenode = $('wanfa_node.Node.' + hide[j]);
            var hidenode = this._nodeList[hide[j]];
            if (hidenode && cc.sys.isObjectValid(hidenode)) {
                hidenode.setVisible(false);
            }
        }
    },

    /**
     * 改变CheckBox
     * @param node
     * @param radio
     * @private
     */
    _changeCheckBox: function (node, radio) {
        var cb1 = node.getChildByName('checkBox1');
        var cb2 = node.getChildByName('checkBox2');
        cb1.setVisible(radio);
        cb2.setVisible(!radio);
        cb1.setName(radio ? 'checkBox' : '_');
        cb2.setName(radio ? '_' : 'checkBox');
    },

    /**
     * checkbox文字监听
     * @param sender
     * @private
     */
    _cbTouch: function (sender) {
        var that = this;
        var tmpStrArr = this._clickMapId.split("_");
        var tmpLocation = parseInt(tmpStrArr[1]);

        //#region 判断王钓的特殊处理
        var isWDSpec = false;
        var clickName = sender.getParent().getName();
        var WDSpecNameArr1 = [
            "withYingHu_0",
            "withQiangGangHu_0",
            "withQiDui_0",
            "withPiao_0"
        ];
        var WDSpecName2 = "quanKaiFang_0";
        var isClick1s = false;
        var isClick2 = false;
        var nomalFunc = function () {
            var userData = sender.getParent().getUserData();
            // 取得checkbox
            var cb = sender.getParent().getChildByName('checkBox');
            var state = cb.isSelected();
            // 处理不可取消
            if (userData.undeselectable && state) {
                return;
            }
            cb.setSelected(!state);
            that.setSelected(sender.getParent(), !state);
        };
        if (!isNaN(tmpLocation)){
            if (this._wanfaData[0][1][tmpLocation][1] == app.map_id.WD){
                if (WDSpecNameArr1.indexOf(clickName) >= 0) {
                    isWDSpec = true;
                    isClick1s = true;
                }
                if (isWDSpec == false && WDSpecName2 == clickName) {
                    isWDSpec = true;
                    isClick2 = true;
                }
            }
        }
        isWDSpec = false;
        //#endregion

        //#region 判断永州扯胡子的特殊处理
        var isYZCHZSpec = false;
        var YZCHZBBtnName = "laiZiCnt";
        var YZCHZBBtnIdx = "4";
        if (!isNaN(tmpLocation)){
            if (this._wanfaData[0][1][tmpLocation][1] == app.map_id.YZCHZ){
                var tmpArr = clickName.split("_");
                YZCHZBBtnIdx = tmpArr[1];
                if (tmpArr[0] == YZCHZBBtnName) isYZCHZSpec = true;
            }
        }

        function handleYZCHZShow(flag) {
            //
            for (var i = 0; i < 3; i++) {
                var tmpNode = sender.getParent().getParent().getChildByName("xianhu_" + i);
                if (cc.sys.isObjectValid(tmpNode)) {
                    tmpNode.setVisible(flag);
                    if (flag == false) {
                        sender.getParent().getParent().getChildByName("xianhu_" + i).getChildByName('checkBox').setSelected(false);
                    }
                }
            }
        }
        //#endregion

        if (isWDSpec){
            var click2State = sender.getParent().getParent().getChildByName(WDSpecName2).getChildByName('checkBox').isSelected();
            if (isClick1s == true) {
                if (click2State == true) {
                    sender.getParent().getParent().getChildByName(WDSpecName2).getChildByName('checkBox').setSelected(false);
                    nomalFunc();
                    return;
                }
                else {
                    nomalFunc();
                    return;
                }
            }
            if (isClick2 == true){
                if (click2State == true){
                    nomalFunc();
                    return;
                }
                else {
                    for (var i = 0; i < WDSpecNameArr1.length; i++){
                        sender.getParent().getParent().getChildByName(WDSpecNameArr1[i]).getChildByName('checkBox').setSelected(false);
                        this.setSelected(sender.getParent().getParent().getChildByName(WDSpecNameArr1[i]), false);
                    }
                    nomalFunc();
                    return;
                }
            }
        }
        else if (isYZCHZSpec){
            if (YZCHZBBtnIdx == "4") {
                nomalFunc();
                handleYZCHZShow(true);
                return;
            }
            else {
                nomalFunc();
                handleYZCHZShow(false);
                return;
            }
        }
        else {
            nomalFunc();
            return;
        }
    },

    /**
     * pop点击
     * @param sender
     * @protected
     */
    _cbTouchPop: function (sender) {
        var that = this;
        var node = sender.getParent();
        var userData = node.getUserData();
        if (!userData) {
            return;
        }
        // 创建一个背景layer，屏蔽点击
        var layer = new cc.Layer();
        this.addChild(layer, 999);
        TouchUtil.setOnclickListener(layer, function () {
            layer.removeFromParent(true);
        }, {effect: TouchUtil.effects.NONE});
        // 检索数组（有关数组的方案后面要重写）
        var cbs = [];
        var name = node.getName();
        var names = name.split('_');
        if (names.length < 2) {
            return;
        }
        var id = Number(_.last(names));
        names = _.dropRight(names);
        var catname = names.join('_');
        if (!isNaN(id)) {
            var i = 0;
            while (true) {
                var cbName = catname + '_' + i;
                if (this._cbList.hasOwnProperty(cbName)) {
                    cbs.push(this._cbList[cbName]);
                } else {
                    break;
                }
                i++;
            }
        }
        // 创建背景
        var bg = node.getChildByName('bg');
        var color = cc.color('#fae8c4');
        var width = bg.getContentSize().width;
        var height = cbs.length * 32;
        var pos = bg.convertToWorldSpace(cc.p(0, 0));
        pos.y -= height;
        var popBg = new cc.LayerColor(color, width, height);
        layer.addChild(popBg);
        popBg.setPosition(pos);
        TouchUtil.setOnclickListener(popBg, function () {
        }, {effect: TouchUtil.effects.NONE});
        // 创建文字
        for (var idx = 0; idx < cbs.length; idx++) {
            var cb = cbs[idx];
            var cbUserData = cb.getUserData();
            if (!cbUserData) {
                continue;
            }
            var desp = cbUserData.desp;
            var text = new ccui.Text();
            text.setFontSize(28);
            text.setAnchorPoint(cc.p(0, 0));
            text.setTextColor(cc.color(0, 0, 0));
            text.setPosition(cc.p(0, idx * 32));
            text.setString(desp);
            text.setName(cbUserData.key + '_' + idx);
            popBg.addChild(text);
            (function (text) {
                TouchUtil.setOnclickListener(text, function () {
                    var node = that._cbList[text.getName()];
                    var cb = node.getChildByName('checkBox');
                    cb.setSelected(true);
                    that.setSelected(node, true);
                    layer.removeFromParent(true);
                }, {effect: TouchUtil.effects.NONE});
            })(text);
        }
    },

    /**
     * checkbox监听
     * @param sender
     */
    _cbListener: function (sender, event) {
        var that = this;
        var tmpStrArr = this._clickMapId.split("_");
        var tmpLocation = parseInt(tmpStrArr[1]);
        //#region 判断王钓的特殊处理
        var isWDSpec = false;
        var clickName = sender.getParent().getName();
        var WDSpecNameArr1 = [
            "withYingHu_0",
            "withQiangGangHu_0",
            "withQiDui_0",
            "withPiao_0"
        ];
        var WDSpecName2 = "quanKaiFang_0";
        var isClick1s = false;
        var isClick2 = false;
        var nomalFunc = function () {
            var userData = sender.getParent().getUserData();
            // 取得checkbox
            var cb = sender.getParent().getChildByName('checkBox');
            var state = cb.isSelected();
            // 处理不可取消
            if (userData.undeselectable && !state) {
                cb.setSelected(true);
                return;
            }
            that.setSelected(sender.getParent(), state);
        };
        if (!isNaN(tmpLocation)){
            if (this._wanfaData[0][1][tmpLocation][1] == app.map_id.WD){
                if (WDSpecNameArr1.indexOf(clickName) >= 0) {
                    isWDSpec = true;
                    isClick1s = true;
                }
                if (isWDSpec == false && WDSpecName2 == clickName) {
                    isWDSpec = true;
                    isClick2 = true;
                }
            }
        }
        isWDSpec = false;
        //#endregion

        //#region 判断永州扯胡子的特殊处理
        var isYZCHZSpec = false;
        var YZCHZBBtnName = "laiZiCnt";
        var YZCHZBBtnIdx = "4";
        if (!isNaN(tmpLocation)){
            if (this._wanfaData[0][1][tmpLocation][1] == app.map_id.YZCHZ){
                var tmpArr = clickName.split("_");
                YZCHZBBtnIdx = tmpArr[1];
                if (tmpArr[0] == YZCHZBBtnName) isYZCHZSpec = true;
            }
        }

        function handleYZCHZShow(flag) {
            //
            for (var i = 0; i < 3; i++) {
                var tmpNode = sender.getParent().getParent().getChildByName("xianhu_" + i);
                if (cc.sys.isObjectValid(tmpNode)) {
                    tmpNode.setVisible(flag);
                    if (flag == false) {
                        sender.getParent().getParent().getChildByName("xianhu_" + i).getChildByName('checkBox').setSelected(false);
                    }
                }
            }
        }
        //#endregion

        if (isWDSpec){
            var click2State = sender.getParent().getParent().getChildByName(WDSpecName2).getChildByName('checkBox').isSelected();
            if (isClick1s == true) {
                if (click2State == true) {
                    //
                    sender.getParent().getParent().getChildByName(WDSpecName2).getChildByName('checkBox').setSelected(false);
                    nomalFunc();
                    /*
                    var userData = sender.getParent().getUserData();
                    // 取得checkbox
                    var cb = sender.getParent().getChildByName('checkBox');
                    var state = cb.isSelected();
                    cb.setSelected(false);
                     */
                    return;
                }
                else {
                    nomalFunc();
                    return;
                }
            }
            if (isClick2 == true){
                click2State = !click2State;
                if (click2State == true){
                    nomalFunc();
                    return;
                }
                else {
                    for (var i = 0; i < WDSpecNameArr1.length; i++){
                        sender.getParent().getParent().getChildByName(WDSpecNameArr1[i]).getChildByName('checkBox').setSelected(false);
                        this.setSelected(sender.getParent().getParent().getChildByName(WDSpecNameArr1[i]), false);
                    }
                    nomalFunc();
                    return;
                }
            }
        }
        else if (isYZCHZSpec){
            if (YZCHZBBtnIdx == "4") {
                nomalFunc();
                handleYZCHZShow(true);
                return;
            }
            else {
                nomalFunc();
                handleYZCHZShow(false);
                return;
            }
        }
        else {
            nomalFunc();
            return;
        }
    },

    /**
     * 设置选择
     * @param node
     * @param selected
     */
    setSelected: function (node, selected) {
        var userData = node.getUserData();
        var light = node.getChildByName('light');
        if (light) {
            light.setVisible(selected);
        }
        var text = node.getChildByName('text');
        if (text) {
            text.setTextColor(selected ? this._textColor.ON : this._textColor.OFF);
        }
        // 不是选中不处理
        if (selected) {
            this._handleArray(node.getName());
            this._handleDepend(node.getName());
            this._handleMutexField(userData.mutexField);
            this._changeFangkaText(node);
        }
        this._handleSpecialDepend(node.getName());
        var self = this;
        //现在只针对永州扯胡子的4人
        function hideSpecNode(){
            var ctrlNames = ["xianhu_0", "xianhu_1", "xianhu_2"];
            for (var i = 0; i < ctrlNames.length; i++) {
                if (self._cbList.hasOwnProperty(ctrlNames[i])) {
                    var node = self._cbList[ctrlNames[i]];
                    if (cc.sys.isObjectValid(node)) node.setVisible(false);
                }
            }
        }

        function handleSpecNode() {
            var ctrlNames = ["laiZiCnt_0", "laiZiCnt_1", "laiZiCnt_2", "laiZiCnt_3"];
            var flag = false;
            for (var i = 0; i < ctrlNames.length; i++) {
                if (self._cbList.hasOwnProperty(ctrlNames[i])) {
                    var node = self._cbList[ctrlNames[i]];
                    if (cc.sys.isObjectValid(node) && node.getChildByName("checkBox").isSelected()) {
                        flag = true;
                        break;
                    }
                }
            }

            if (flag == true) hideSpecNode();
        }
        handleSpecNode();
    },

    /**
     * 处理数组
     * @param name
     * @protected
     */
    _handleArray: function (name) {
        var names = name.split('_');
        if (names.length < 2) {
            return;
        }
        var id = Number(_.last(names));
        names = _.dropRight(names);
        var catname = names.join('_');
        if (!isNaN(id)) {
            var i = 0;
            // 这里是个死循环，谨慎！
            while (true) {
                var cbName = catname + '_' + i;
                if (this._cbList.hasOwnProperty(cbName)) {
                    var isPopup = _.last(catname.split('_')) == 'popup';
                    var cb = this._cbList[cbName].getChildByName('checkBox');
                    if (cbName != name) {
                        cb.setSelected(false);
                        this.setSelected(this._cbList[cbName], false);
                        if (isPopup) {
                            // cc.log("隐藏："+cbName);
                            this._cbList[cbName].setVisible(false);
                            cb.setVisible(false);
                        }
                    } else {
                        if (isPopup) {
                            // cc.log("显示："+cbName);
                            this._cbList[cbName].setVisible(true);
                            cb.setVisible(true);
                        }
                    }
                } else {
                    break;
                }
                i++;
            }
        }
    },

    /**
     * 处理依赖(mapid)
     * @param name
     * @protected
     */
    _handleDepend: function (name) {
        //不处理mapid以外的依赖
        if (name.indexOf('mapid') != 0) {
            return;
        }
        for (var id in this._cbList) {
            if (this._cbList.hasOwnProperty(id)) {
                var cb = this._cbList[id];
                var userData = cb.getUserData();
                var depend = userData.depName;
                if (!depend) {
                    continue;
                }
                if (!_.isArray(depend)) {
                    depend = [depend];
                }
                for (var i = 0; i < depend.length; i++) {
                    if (name == depend[i]) {
                        var isPopup = _.last(userData.key.split('_')) == 'popup';
                        if (isPopup) {
                            cb.setVisible(userData.state);
                        } else {
                            cb.setVisible(true);
                        }
                        break;
                    } else {
                        cb.setVisible(false);
                    }
                }
            }
        }
    },

    /**
     * 处理互斥
     * @param mutexField
     * @protected
     */
    _handleMutexField: function (mutexField) {
        if (!mutexField) {
            return;
        }
        if (!_.isArray(mutexField)) {
            mutexField = [mutexField];
        }
        for (var i = 0; i < mutexField.length; i++) {
            var cbName = mutexField[i];
            if (this._cbList.hasOwnProperty(cbName)) {
                var cb = this._cbList[cbName].getChildByName('checkBox');
                cb.setSelected(false);
                this.setSelected(this._cbList[cbName], false);
            }
        }
    },

    /**
     * 处理特殊依赖关系
     * @protected
     */
    _handleSpecialDepend: function () {
        this._handlePopup();
        this._handleClubHunZhuo();
    },


    /**
     * 俱乐部混桌处理
     * @private
     */
    _handleClubHunZhuo: function () {
        if (!this._clubHunZhuoData) {
            return;
        }
        //是俱乐部创建房间
        var isClubCreate = (this._clubId && (this._setwanfapos && this._setwanfapos != 5 && gameData.useNewClub));
        var curConfig = this._clubHunZhuoData[this._curSelectedTab];
        if (curConfig) {
            var hideNodes = curConfig['hide'];
            var viewNodes = curConfig['view'];
            var i;
            for (i = 0; i < hideNodes.length; i++) {
                var hideNode = this._cbList[hideNodes[i] + '_0'];
                if (hideNode) hideNode.setVisible(!isClubCreate);
                var hideNode1 = this._cbList[hideNodes[i] + '_1'];
                if (hideNode1) hideNode1.setVisible(!isClubCreate);
                var hideNode2 = this._cbList[hideNodes[i] + '_2'];
                if (hideNode2) hideNode2.setVisible(!isClubCreate);
            }
            for (i = 0; i < viewNodes.length; i++) {
                var viewNode = this._cbList[viewNodes[i] + '_0'];
                if (viewNode) viewNode.setVisible(isClubCreate);
            }
        }
    },


    /**
     * 弹出框
     * @private
     */
    _handlePopup: function () {
        // 下拉栏选中
        for (var id in this._cbList) {
            if (this._cbList.hasOwnProperty(id)) {
                var node = this._cbList[id];
                var userData = node.getUserData();
                if (userData.isPopup) {
                    var cd = node.getChildByName('checkBox');
                    var depend = userData.depName;
                    if (!depend) {
                        continue;
                    }
                    if (!_.isArray(depend)) {
                        depend = [depend];
                    }

                    for (var i = 0; i < depend.length; i++) {
                        if (this._clickMapId == depend[i]) {
                            node.setVisible(cd.isSelected());
                            cd.setVisible(cd.isSelected());
                            break;
                        } else {
                            node.setVisible(false);
                            cd.setVisible(cd.isSelected());
                        }
                    }
                    var light = node.getChildByName('light');
                    if (light) {
                        light.setVisible(false);
                    }
                }
            }
        }
    },

    /**
     * 取得特殊玩法(这里做强行匹配，以后再想更好的方法)
     * @param key
     * @param desp
     * @returns {*}
     * @protected
     */
    _getSpecialDesp: function (key, desp) {
        var ret;
        switch (key) {
            case 'jushu':
            case 'rounds':
                ret = '局数: ' + desp;
                break;
            case 'siren':
            case 'sanrenwan':
            case 'liangrenwan':
                ret = '人数: ' + desp;
                break;
            case 'zhaniao':
                ret = '抓码: ' + desp;
                break;
            case 'Difen':
                ret = '底分: ' + desp;
                break;
            case 'BeiShu':
                ret = '最大抢庄: ' + desp;
                break;
            case 'MaxTuizhu':
                ret = '推注: ' + desp;
                break;
            default:
                ret = desp;
                break;
        }
        return ret;
    },

    /**
     * 胡子和牛牛有一堆特殊map值需要生成，在这里统一处理
     * @param key
     * @param desp
     * @protected
     */
    _generateExtraDespMap: function (key, desp) {
        if (CreateR.EXTRA_DESP_MAP.hasOwnProperty(key)) {
            mRoom.wanfaMap[CreateR.EXTRA_DESP_MAP[key]] = desp;
        }
    },

    /**
     * 生成特殊参数
     * @param key
     * @param desp
     * @protected
     */
    _generateSpecialGz: function (key, desp) {
        if (_.indexOf(CreateR.SPECIAL_GZ_MAP, key)) {
            if (desp && desp != '')
                mRoom.special_gz.push(desp);
        }
    },

    /**
     * todo 这里之后一定要改！！！
     * 生成玩法参数（又是奇怪的参数，以后希望和mapid统一）
     * @protected
     */
    _generateSpecialWanfa: function () {
        // var key = findKey(MAP_ID, mRoom.wanfaMap.mapid);
        // if (key) {
        //     mRoom.wanfaMap.wanfa = MAP_ID_2_WANFA[key];
        // }
        // // 牛牛一堆特殊的判断(实在摘不出去了,这些判断太JB傻了)
        // if (mRoom.wanfaMap.mapid == MAP_ID.DN) {
        //     if (!mRoom.wanfaMap.Players) {
        //         mRoom.wanfaMap.Players = 'liu';
        //     }
        //     if (mRoom.wanfaMap.Players == 'jiu') {
        //         mRoom.wanfaMap.mapid = MAP_ID.DN_JIU_REN;
        //     }
        //     if (mRoom.wanfaMap.AlwaysTui) {
        //         mRoom.wanfaMap.mapid = MAP_ID.DN_AL_TUI;
        //         mRoom.wanfaMap.DisableHeiqiang = false;
        //     }
        //     mRoom.wanfaMap.Beilv = "zhuzhou";
        //     if (mRoom.wanfaMap.noColor) {
        //         mRoom.wanfaMap.mapid = MAP_ID.DN_WUHUA_CRAZY;
        //         mRoom.wanfaMap.Beilv = "wuhua";
        //     }
        //     if (mRoom.wanfaMap.crazy) {
        //         mRoom.wanfaMap.mapid = 4002;
        //         mRoom.wanfaMap.Beilv = "crazy";
        //     }
        //     if (mRoom.wanfaMap.AA || mRoom.wanfaMap.ChipInType == 1) {
        //         mRoom.wanfaMap.Is_ztjr = false;
        //     } else {
        //         if (gameData.opt_conf && gameData.opt_conf.isztjr_0 == 1) {
        //             mRoom.wanfaMap.Is_ztjr = false;
        //         } else {
        //             // mRoom.wanfaMap.Is_ztjr = !mRoom.wanfaMap.Is_ztjr;
        //             mRoom.wanfaMap.Is_ztjr = !mRoom.wanfaMap.isztjr;
        //             delete  mRoom.wanfaMap.isztjr;
        //         }
        //     }
        //     if (mRoom.wanfaMap.name == '明牌抢庄') {
        //         mRoom.wanfaMap.Preview = 'si';
        //     }
        //     if (mRoom.wanfaMap.Preview && mRoom.wanfaMap.Preview.length > 0) {
        //         mRoom.wanfaMap.Cuopai = !mRoom.wanfaMap.Cuopai;
        //     } else {
        //         delete  mRoom.wanfaMap.Cuopai;
        //     }
        // } else if (mRoom.wanfaMap.mapid == MAP_ID.ZJH) {
        //     if (gameData.opt_conf.zjkztjr == 1) {
        //         if (!mRoom.wanfaMap.yunxujiaru) {
        //             mRoom.wanfaMap.yunxujiaru = true;
        //         }
        //         if (mRoom.wanfaMap.AA) {
        //             mRoom.wanfaMap.yunxujiaru = false;
        //             mRoom.wanfa += ",禁止中途加入";
        //         }
        //     }
        // }else if(mRoom.wanfaMap.mapid == MAP_ID.PDK){
        //     //3张可少带接完
        //     if(!mRoom.wanfaMap['szksdjw']){
        //         mRoom.wanfaMap['szksdjw'] = false;
        //     }
        // }
    }
});
// ----------- 数组位含义 ------------
var CreateR = {};
/**
 * 名称
 * @type {number}
 */
CreateR.IDX_DESP = 0;

/**
 * 值
 * @type {number}
 */
CreateR.IDX_VALUE = 1;

/**
 * x位置
 * @type {number}
 */
CreateR.IDX_POSX = 2;

/**
 * y位置
 * @type {number}
 */
CreateR.IDX_POSY = 3;

/**
 * 默认选不选中
 * @type {number}
 */
CreateR.IDX_DEF_VAL = 4;

/**
 * 能不能不选中
 * @type {number}
 */
CreateR.IDX_UNDESELECTABLE = 5;

/**
 * 置灰
 * @type {number}
 */
CreateR.IDX_DISABLE = 6;

/**
 * 排斥
 * @type {number}
 */
CreateR.IDX_MUTEX_FIELD = 7;

/**
 * 依赖关系
 * @type {number}
 */
CreateR.IDX_DEP_NAME = 8;

/**
 * 介绍文本
 * @type {number}
 */
CreateR.IDX_HINT = 9;
// ----------------------------------

/**
 * _sub ccs 路径
 * @type {string}
 */
CreateR.CCS_SUB_PATH = 'res/submodules/';

/**
 * tablist ccs 名字
 * @type {string}
 */
CreateR.CCS_TAB_LIST_NAME = '/ccs/CreateTabList';

/**
 * 玩法 ccs 名字
 * @type {string}
 */
CreateR.CCS_WANFA_NAME = '/ccs/CreateWanfa';
/**
 * 牛牛和胡子需要的特殊参数
 * @type {object}
 */
CreateR.EXTRA_DESP_MAP = {
    mapid: 'name',
    ZhuangMode: 'zhuang_gz',
    Chipin: 'basescore',
    AA: 'room_gz',
    Tuizhu: 'gaoji',
    ChipInType: 'gaoji'
};

/**
 * 需要加入special_gz的列表
 * @type {Array}
 */
CreateR.SPECIAL_GZ_MAP = [
    'Wuhuaniu',
    'Zhadan',
    'Wuxiaoniu',
    'Preview',
    'Shunzi',
    'Hulu',
    'Tonghua'
];